package com.gqz.defect.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gqz.common.core.domain.R;
import com.gqz.common.core.domain.RequestForm;
import com.gqz.defect.api.EnDefectsSheetApi;
import com.gqz.defect.service.IEnDefectsSheetRelService;
import com.gqz.defect.service.IEnDefectsSheetService;
import com.gqz.defect.vo.*;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 消缺工单表 Controller
 */
@RestController
@RequestMapping("/en-defects-sheet")
public class EnDefectsSheetController implements EnDefectsSheetApi {

    @Autowired
    private IEnDefectsSheetService service;
    @Autowired
    private IEnDefectsSheetRelService enDefectsSheetRelService;

//    @Resource
//    private GisFegin gisFegin;

    @Override
    public R<List<EnDefectsSheetVo>> getById(String id) {
        return R.ok(service.getById(id));
    }

    @Override
    public R<Page<EnDefectsSheetVo>> page(@Valid RequestForm<EnDefectsSheetVo> requestForm) {
        return R.ok(service.page(requestForm));
    }

    @Override
    public R<Long> count(@Valid RequestForm<EnDefectsSheetVo> requestForm) {
        return R.ok(service.count(requestForm));
    }

    @Override
    public R<Integer> insert(@Valid EnDefectsSheetListVo vos) {
        return R.ok(service.insert(vos));
    }

    @Override
    public R<Integer> update(@Valid EnDefectsSheetListVo vos) {
        return R.ok(service.update(vos));
    }

    @Override
    public R<Integer> delete(@Valid List<String> ids) {
        return R.ok(service.deleteByIds(ids));
    }

    @Override
    public void exportExcel(HttpServletResponse response, @Valid RequestForm<EnDefectsSheetVo> requestForm) {
        service.exportExcel(response, requestForm);
    }

    @Override
    public R<List<EnDefectsSheetRelVo>> getBySheetId(String sheet_id) {
        return R.ok(enDefectsSheetRelService.getBySheetId(sheet_id));
    }

    @Override
    public R<Integer> pdSend(List<EnDefectsSheetVo> vos) {
        return R.ok(service.pdSend(vos));
    }

    @Override
    public R<Integer> zlpjSend(EnDefectsSheetVo vos) {
        return R.ok(service.zlpjSend(vos));
    }

    @Override
    public R<List<TEnDefectsSheetOperateVo>> getBaseProcessList(String sheet_id) {
        return R.ok(service.getBaseProcessList(sheet_id));
    }

    @Override
    public R<Object> getDjbh() {
        return R.ok(service.getDjbh());
    }

    @Override
    public R<List<EnDefectsGisVo>> energyPtgis(String startTime, String endTime, String yhid) {
//        return R.ok(gisFegin.list(startTime,endTime,yhid));
        return R.ok(null);
    }

    @Override
    public List<EnTjVo> getGdStatusXx(String sdate, String edate) {
        return service.getGdStatusXx(sdate, edate);
    }
}
